﻿using System;
using System.Collections.Generic;
using System.Text;
using System.ServiceModel;
using Sinacor.Infra.Service.Security.Services;
using Sinacor.Servico.Bovespa.Corretagem.Service.ServiceContract;

namespace Sinacor.Servico.Bovespa.Corretagem.Service.ServiceImplementation
{

    /// <summary>
    /// Classe de implementacao de contrato de servico Corretagem
    /// </summary>
    [SinacorServiceBehavior]
    public class Taxa : ITaxa
    {
        #region Campos

        private BusinessLogic.Taxa _taxa;

        #endregion

        #region Construtor
        public Taxa()
        {
            _taxa = new BusinessLogic.Taxa();
        }
        #endregion

        #region [PUB] AlterarTaxa
        public void AlterarTaxa(DataContract.Request.TaxaRequest request)
        {
            Translator.DataContractToBusinessEntity.Taxa translateRequest = new Translator.DataContractToBusinessEntity.Taxa();

            _taxa.AlterarTaxa(translateRequest.ToTaxa(request));  
            
        }
        #endregion

        #region [PUB] AlterarTaxas
        public void AlterarTaxas(List<DataContract.Request.TaxaRequest> request)
        {
            Translator.DataContractToBusinessEntity.Taxa translateRequest = new Translator.DataContractToBusinessEntity.Taxa();

            _taxa.AlterarTaxas(translateRequest.ToTaxa(request));

        }
        #endregion

        #region [PUB] ConsultarTaxas
        public List<DataContract.Response.TaxaResponse> ConsultarTaxas(DataContract.Request.FiltroTaxaRequest request)
        {
            Translator.DataContractToBusinessEntity.Taxa translateRequest = new Translator.DataContractToBusinessEntity.Taxa();

            Translator.BusinessEntityToDataContract.Taxa translatebusinessentity = new Translator.BusinessEntityToDataContract.Taxa();

            List<BusinessEntity.Taxa> listataxabusinessentity = _taxa.ConsultarTaxas(translateRequest.ToFiltroTaxa(request));

            List<DataContract.Response.TaxaResponse> listataxaresponse = translatebusinessentity.ToTaxaResponse(listataxabusinessentity);
            
         return listataxaresponse;

        }
        #endregion

        #region [PUB] ExcluirTaxa
        public void ExcluirTaxa(DataContract.Request.ChaveTaxaRequest request)
        {
            Translator.DataContractToBusinessEntity.Taxa translateRequest = new Translator.DataContractToBusinessEntity.Taxa();

            _taxa.ExcluirTaxa(translateRequest.ToChaveTaxa(request));

        }
        #endregion

        #region [PUB] ExcluirTaxas
        public void ExcluirTaxas(List<DataContract.Request.ChaveTaxaRequest> request)
        {
            Translator.DataContractToBusinessEntity.Taxa translateRequest = new Translator.DataContractToBusinessEntity.Taxa();

            _taxa.ExcluirTaxas(translateRequest.ToChaveTaxa(request));

        }
        #endregion

        #region [PUB] ExecutarTransacoes
        public void ExecutarTransacoes(List<DataContract.Request.TaxaRequest> listaInclusao, List<DataContract.Request.ChaveTaxaRequest> listaExclusao, List<DataContract.Request.TaxaRequest> listaAlteracao)
        {
            Translator.DataContractToBusinessEntity.Taxa translateRequest = new Translator.DataContractToBusinessEntity.Taxa();

            _taxa.ExecutarTransacoes(translateRequest.ToTaxa(listaInclusao), translateRequest.ToChaveTaxa(listaExclusao), translateRequest.ToTaxa(listaAlteracao));

        }
        #endregion

        #region [PUB] IncluirTaxa
        public void IncluirTaxa(DataContract.Request.TaxaRequest request)
        {
            Translator.DataContractToBusinessEntity.Taxa translateRequest = new Translator.DataContractToBusinessEntity.Taxa();

            _taxa.IncluirTaxa(translateRequest.ToTaxa(request));
        }


        #endregion

        #region [PUB] IncluirTaxas
        public void IncluirTaxas(List<DataContract.Request.TaxaRequest> request)
        {
            Translator.DataContractToBusinessEntity.Taxa translateRequest = new Translator.DataContractToBusinessEntity.Taxa();

            _taxa.IncluirTaxas(translateRequest.ToTaxa(request));
        }


        #endregion

    }
}